ThinkPHP5


think\Db
library\think\Db.php at line 47

Class Db

Db

public class Db

Class Db

Method:
Query table(string $table) static 指定数据表(含前缀)
Query name(string $name) static 指定数据表(不含前缀)
Query where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询
Query union(mixed $union, boolean $all = false) static UNION查询
Query limit(mixed $offset, integer $length = null) static 查询LIMIT
Query order(mixed $field, string $order = null) static 查询ORDER
Query cache(mixed $key = true , integer $expire = null) static 设置查询缓存
mixed value(string $field) static 获取某个字段的值
array column(string $field, string $key = '') static 获取某个列的值
Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
mixed find(mixed $data = []) static 查询单个记录
mixed select(mixed $data = []) static 查询多个记录
integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一条记录
integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一条记录并返回自增ID
integer insertAll(array $dataSet) static 插入多条记录
integer update(array $data) static 更新记录
integer delete(mixed $data = []) static 删除记录
boolean chunk(integer $count, callable $callback, string $column = null) static 分块获取数据
mixed query(string $sql, array $bind = [], boolean $fetch = false, boolean $master = false, mixed $class = false) static SQL查询
integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL执行
PaginatorCollection paginate(integer $listRows = 15, mixed $simple = false, array $config = []) static 分页查询
mixed transaction(callable $callback) static 执行数据库事务
boolean batchQuery(array $sqlArray) static 批处理执行SQL语句

Field Summary
static mixed

$executeTimes

static mixed

$queryTimes

Method Summary
static \think\db\Connection

connect(mixed config, bool|string name)

数据库初始化 并取得数据库类实例

Field Detail

library\think\Db.php at line 54

executeTimes

public static mixed $executeTimes = 0

library\think\Db.php at line 52

queryTimes

public static mixed $queryTimes = 0

Method Detail

library\think\Db.php at line 65

connect

public static \think\db\Connection connect(mixed config, bool|string name)

数据库初始化 并取得数据库类实例

Parameters:
config - 连接配置
name - 连接标识 true 强制重新连接
Throws:
Exception

ThinkPHP5